package day08;

import java.util.Scanner;
import java.util.Arrays;

public class Test05 {
    public static void main(String[] args) {
        int i = 0;
        Scanner in = new Scanner(System.in);

        System.out.println("请输入数据并用空格分隔！");
        String tmp = in.nextLine();//将一行数据读出
        String arr[] = tmp.split("\\s+");//使用正则表达式将字符串分割 “\\s+”表示多个空格

        int arr1[] = new int[arr.length];


        for (String s : arr) {
            arr1[i] = Integer.parseInt(s);//将字符串转换为int数组
            i++;
        }
        extracted(arr1);
        System.out.println("最大值为："+arr1[arr1.length-1]);
    }



        private static void extracted ( int[] arr){
            double max=0;    int z=0;
            for (int i=0;i<arr.length-1;i++) {
               if(arr[i]> arr[i+1]){
                z=arr[i];
                arr[i]=arr[i+1];
                arr[i+1]=z;

               }
            }
        }
}
